package com.ecoolex.ying.space.enums;

import com.ecoolex.framework.common.EnumInterface;
import com.ecoolex.framework.common.util.Check;
import com.ecoolex.ying.space.entity.UserWorks;

public enum UserWorksStatus implements EnumInterface<UserWorksStatus, Integer>{

	EDIT(1, "编辑中"),
	RELEASE(2, "已发布");

	private int real;

	private String describe;

	private UserWorksStatus(int real, String describe) {
		this.real = real;
		this.describe = describe;
	}

	@Override
	public Integer real() {
		return real;
	}

	@Override
	public String describe() {
		return describe;
	}

	@Override
	public UserWorksStatus realOf(Integer real) {
		if (Check.notNull(real)) {
			for (UserWorksStatus v : values()) {
				if (v.real().equals(real)) {
					return v;
				}
			}
		}
		return null;
	}
	
	public static final boolean canRelease(UserWorks userWorks) {
		return EDIT.equal(userWorks.getStatus());
	}
}
